package com.grass.p019lv.novel.adapter;

import android.content.Intent;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.bean.novel.FictionList;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.base.utils.SpUtils;
import com.androidx.p013lv.base.utils.UiUtils;
import com.grass.p019lv.novel.activity.VoiceNovelLabelActivity;
import java.util.List;

/* renamed from: com.grass.lv.novel.adapter.AudioFictionCAdapter */
public class AudioFictionCAdapter extends BaseRecyclerAdapter<FictionList, Holder> {
    String domain;

    public void setDomain(String str) {
        this.domain = str;
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((FictionList) this.list.get(i), i);
    }

    public void onViewRecycled(Holder holder) {
        super.onViewRecycled((RecyclerView.ViewHolder) holder);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_audio_fiction_c, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.grass.lv.novel.adapter.AudioFictionCAdapter$Holder */
    public class Holder extends BaseRecyclerHolder {
        ImageView iv_cover;
        LinearLayout ll_label_tag;
        RelativeLayout rl_cover;
        TextView tv_favorites_num;
        TextView tv_label1;
        TextView tv_label2;
        TextView tv_label3;
        TextView tv_listen_num;
        TextView tv_title;

        public Holder(View view) {
            super(view);
            this.rl_cover = (RelativeLayout) view.findViewById(R.id.rl_cover);
            this.iv_cover = (ImageView) view.findViewById(R.id.iv_cover);
            this.tv_title = (TextView) view.findViewById(R.id.tv_title);
            this.ll_label_tag = (LinearLayout) view.findViewById(R.id.ll_label_tag);
            this.tv_label1 = (TextView) view.findViewById(R.id.tv_label1);
            this.tv_label2 = (TextView) view.findViewById(R.id.tv_label2);
            this.tv_label3 = (TextView) view.findViewById(R.id.tv_label3);
            this.tv_listen_num = (TextView) view.findViewById(R.id.tv_listen_num);
            this.tv_favorites_num = (TextView) view.findViewById(R.id.tv_favorites_num);
            ViewGroup.LayoutParams layoutParams = this.rl_cover.getLayoutParams();
            layoutParams.height = UiUtils.dp2px(84);
            layoutParams.width = UiUtils.dp2px(84);
            this.rl_cover.setLayoutParams(layoutParams);
        }

        public void setData(FictionList fictionList, int i) {
            this.tv_title.setText(fictionList.getFictionTitle());
            TextView textView = this.tv_listen_num;
            textView.setText(UiUtils.num2str(fictionList.getFakeWatchTimes()) + "");
            TextView textView2 = this.tv_favorites_num;
            textView2.setText(UiUtils.num2str(fictionList.getFakeLikes()) + "");
            if (!TextUtils.isEmpty(fictionList.getCoverImg())) {
                GlideUtils.loadCropRadiusWh2(SpUtils.getInstance().getString("domain") + fictionList.getCoverImg(), 6, this.iv_cover, 600);
            } else {
                GlideUtils.loadCropRadiusDefault(6, this.iv_cover);
            }
            final List<FictionList.TagList> tagList = fictionList.getTagList();
            this.tv_label1.setVisibility(8);
            this.tv_label2.setVisibility(8);
            this.tv_label3.setVisibility(8);
            if (tagList != null && tagList.size() > 0) {
                if (tagList.get(0) != null) {
                    TextView textView3 = this.tv_label1;
                    textView3.setText(tagList.get(0).getTitle() + "");
                    this.tv_label1.setVisibility(0);
                    this.tv_label1.setOnClickListener(new View.OnClickListener() {
                        /* class com.grass.p019lv.novel.adapter.AudioFictionCAdapter.Holder.View$OnClickListenerC31351 */

                        public void onClick(View view) {
                            Intent intent = new Intent(view.getContext(), VoiceNovelLabelActivity.class);
                            intent.putExtra(Key.TITLE, ((FictionList.TagList) tagList.get(0)).getTitle());
                            intent.putExtra("tagId", ((FictionList.TagList) tagList.get(0)).getTagId());
                            view.getContext().startActivity(intent);
                        }
                    });
                }
                if (tagList.size() > 1 && tagList.get(1) != null) {
                    TextView textView4 = this.tv_label2;
                    textView4.setText(tagList.get(1).getTitle() + "");
                    this.tv_label2.setVisibility(0);
                    this.tv_label2.setOnClickListener(new View.OnClickListener() {
                        /* class com.grass.p019lv.novel.adapter.AudioFictionCAdapter.Holder.View$OnClickListenerC31362 */

                        public void onClick(View view) {
                            Intent intent = new Intent(view.getContext(), VoiceNovelLabelActivity.class);
                            intent.putExtra(Key.TITLE, ((FictionList.TagList) tagList.get(1)).getTitle());
                            intent.putExtra("tagId", ((FictionList.TagList) tagList.get(1)).getTagId());
                            view.getContext().startActivity(intent);
                        }
                    });
                }
                if (tagList.size() > 2 && tagList.get(2) != null) {
                    TextView textView5 = this.tv_label3;
                    textView5.setText(tagList.get(2).getTitle() + "");
                    this.tv_label3.setVisibility(0);
                    this.tv_label3.setOnClickListener(new View.OnClickListener() {
                        /* class com.grass.p019lv.novel.adapter.AudioFictionCAdapter.Holder.View$OnClickListenerC31373 */

                        public void onClick(View view) {
                            Intent intent = new Intent(view.getContext(), VoiceNovelLabelActivity.class);
                            intent.putExtra(Key.TITLE, ((FictionList.TagList) tagList.get(2)).getTitle());
                            intent.putExtra("tagId", ((FictionList.TagList) tagList.get(2)).getTagId());
                            view.getContext().startActivity(intent);
                        }
                    });
                }
            }
        }
    }
}
